<template>
  <div>
    <!-- 按钮 -->
    <div class="btns">
      <el-button type="primary" @click="toPublishArticle">发布疫情资讯</el-button>
    </div>
    <!-- 表格 -->
    <el-table :data="articles.list">
      <el-table-column label="标题" prop="title"></el-table-column>
      <el-table-column label="发布时间" prop="publishTime"></el-table-column>
      <el-table-column label="阅读次数" prop="readTimes"></el-table-column>
      <el-table-column label="所属分类" prop="category.name"></el-table-column>
      <el-table-column label="操作"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import {get} from '@/utils/request'
export default {
  data(){
    return {
      articles:{ list:[] },
      param:{
        page:1,
        pageSize:5
      }
    }
  },
  mounted(){
    this.loadArticles();
  },
  methods:{
    // 去发布资讯
    toPublishArticle(){
      // 跳转到资讯发布页面
      this.$router.push({
        path:'/cms/article_create'
      })
    },
    loadArticles(){
      let url = "http://121.199.29.84:8002/article/pageQuery";
      get(url,this.param).then(resp => {
        this.articles = resp.data;
      })
    }
  }
}
</script>
<style scoped>

</style>